package io.yichen.usbflutter.usb.driver;

import java.util.HashMap;
import java.util.Map;

public class UsbResult {

    public int code;
    public String msg;

    public static UsbResult suc() {
        return new UsbResult();
    }

    public static UsbResult err() {
        UsbResult result = new UsbResult();
        result.code = -1;
        return result;
    }

    public UsbResult msg(String msg) {
        this.msg = msg;
        return this;
    }

    public Map<String, Object> toMap() {
        Map<String, Object> map = new HashMap<>();
        map.put("code", code);
        map.put("msg", msg);
        return map;
    }

}
